{include file="header.html"}
<script type="text/javascript" src="templates/js/jquery.colorbox.js"
        charset="utf-8"></script>
<link href="templates/style/colorbox.css" rel="stylesheet"
      type="text/css" />
<script type="text/javascript">
    var l=100000;
    var i=1000000;
    $(function(){
        bindListener();
        bindListener2();
        $("[id^='h_type_']").live("change",function(){
            var type = $(this).val();
            if(type==1){
                $(this).parent().parent().next().find('.range').hide();
            }else{
                $(this).parent().parent().next().find('.range').show();
            }
        });
        $(".addhandle").on("click",addhandle);
        $('#main_form').validate({
            errorPlacement: function(error, element){
            },
            success       : function(element){
                $(element).next('.noerror').show();
                $(element).remove();

            },
            rules : {
                zhdm_type : {
                    required : true
                },
                zhdm_name :{
                    required : true
                }
            },
            messages : {
                zhdm_type : {
                    required : '业务类型必填'
                },
                zhdm_name : {
                    required : '运程定义必填'
                }
            }
        });
        $('.formbtn').click(function(){
            $("#zhdm_type").removeAttr("disabled");
            var bug = true;
            $("input[id^='h_short_name_']").each(function(){
                var short_name = $(this).val();
                var item = $(this).attr("item");
                if(item=="{line}"){
                    bug = true;
                }else{
                    if(short_name=='' || short_name==null){
                        $(this).addClass("error");
                        bug = false;
                    }
                }

            })
            $("input[id^='h_name_']").each(function(){
                var name = $(this).val();
                var item = $(this).attr("item");
                if(item=="{line}"){
                    bug = true;
                }else{
                    if(name=='' || name==null){
                        $(this).addClass("error");
                        bug = false;
                    }
                }
            })
            $("input[id^='h_linkman_']").each(function(){
                var linkman = $(this).val();
                var item = $(this).attr("item");
                if(item=="{line}"){
                    bug = true;
                }else{
                    if(linkman=='' || linkman==null){
                        $(this).addClass("error");
                        bug = false;
                    }else{
                        if(linkman=='' || linkman==null){
                            $(this).addClass("error");
                            bug = false;
                        }
                    }
                }

            })
            $("input[id^='h_linkman_tel_']").each(function(){
                var linkman_tel = $(this).val();
                var item = $(this).attr("item");
                if(item=="{line}"){
                    bug = true;
                }else{
                    if(linkman_tel==''){
                        $(this).addClass("error");
                        bug = false;
                    }
                }

            });
            $("input[id^='h_range_']").each(function(){
                var range = $(this).val();
                var item = $(this).attr("item");
                if(item=="{line}"){
                    bug = true;
                }else{
                    if(isNaN(range) && range!=''){
                        $(this).addClass("error");
                        bug = false;
                    }
                }
            })

            $("input[id^='h_order_']").each(function(){
                var order = $(this).val();
                var item = $(this).attr("item");
                if(item=="{line}"){
                    bug = true;
                }else{
                    if(order=='' || order==0){
                        $(this).addClass("error");
                        bug = false;
                    }else if(isNaN(order)){
                        $(this).addClass("error");
                        bug = false;
                    }
                }
            })
            
            if( bug == true){
                $("#main_form").submit();
            }
        })
        $("#zhdm_consignor_img").live('click',function(){
            var id=$(this).attr("item");
            $w=$(window).width();
            $h=$(window).height();
            $w=$w*0.7;
            $("#hzframe").attr("src","index.php?app=datarefer&act=choosehz");
            $("#hzframe").width($w);
            $.colorbox({
                width : $w+20,
                height : "650px",
                inline : true,
                href : "#hzlist"
            });
        });
        
       $("input[id^='h_short_name_']").focus(function(){
            $(this).removeClass("error");
          
       })
       $("input[id^='h_name_']").focus(function(){
           $(this).removeClass("error");
         
       })
       $("input[id^='h_linkman_']").focus(function(){
           $(this).removeClass("error");
         
       })
       $("input[id^='h_linkman_tel_']").focus(function(){
           $(this).removeClass("error");
          
       })
       $("input[id^='h_order_']").focus(function(){
           $(this).removeClass("error");
         
       })


        $("[id^='h_linkman_img_']").off("click");
        $("[id^='h_linkman_img_']").on("click",man_click);

        $("[id^='h_linkman_tel_img_']").off("click");
        $("[id^='h_linkman_tel_img_']").on("click",tel_click);

        $("[id^='h_address_img_']").off("click");
        $("[id^='h_address_img_']").on("click",address_click);

        $("[id^='h_date_img_']").off("click");
        $("[id^='h_date_img_']").on("click",time_click);
        $("#zhdm_type").change(function () {
            $("[id^='h_linkman_']").attr("value","");
            $("[id^='h_linkman_tel_']").attr("value","");
            $("[id^='h_address_']").attr("value","");
            $("[id^='h_date_']").attr("value","");
        });
    })
    function man_click(){
        var id = $(this).attr("item");
        $w=$(window).width();
        $h=$(window).height();
        $w=$w*0.5;
        $("#manframe").attr("src","index.php?app=haul_define_main&act=chooseman"+"&type="+$("#zhdm_type").val()+"&id="+id);
        $("#manframe").width($w);
        $.colorbox({
            width : $w+20,
            height : "650px",
            inline : true,
            href : "#manlist"
        });
    }
    function tel_click(){
        var id = $(this).attr("item");
        $w=$(window).width();
        $h=$(window).height();
        $w=$w*0.5;
        $("#telframe").attr("src","index.php?app=haul_define_main&act=choosetel"+"&type="+$("#zhdm_type").val()+"&id="+id);
        $("#telframe").width($w);
        $.colorbox({
            width : $w+20,
            height : "650px",
            inline : true,
            href : "#tellist"
        });
    }
    function address_click(){
        var id = $(this).attr("item");
        $w=$(window).width();
        $h=$(window).height();
        $w=$w*0.5;
        $("#addressframe").attr("src","index.php?app=haul_define_main&act=chooseaddress"+"&type="+$("#zhdm_type").val()+"&id="+id);
        $("#addressframe").width($w);
        $.colorbox({
            width : $w+20,
            height : "650px",
            inline : true,
            href : "#addresslist"
        });
    }
    function time_click(){
        var id = $(this).attr("item");
        $w=$(window).width();
        $h=$(window).height();
        $w=$w*0.5;
        $("#timeframe").attr("src","index.php?app=haul_define_main&act=choosetime"+"&type="+$("#zhdm_type").val()+"&id="+id);
        $("#timeframe").width($w);
        $.colorbox({
            width : $w+20,
            height : "650px",
            inline : true,
            href : "#timelist"
        });
    }
    function changeman(id,value){
        $('manframe').colorbox.close();
        $("[id^='h_linkman_"+id+"']").val(value);
    }
    function changetel(id,value){
        $('telframe').colorbox.close();
        $("[id^='h_linkman_tel_"+id+"']").val(value);
    }
    function changeaddress(id,value){
        $('addressframe').colorbox.close();
        $("[id^='h_address_"+id+"']").val(value);
    }
    function changetime(id,value){
        $('timeframe').colorbox.close();
        $("[id^='h_date_"+id+"']").val(value);
    }

    //货主新弹框
    function changehz(id,name,hzid,linkman,linktel){
        $('hzframe').colorbox.close();
        $("#zhdm_consignor").val(id);
        $("#zhdm_consignor_name").val(name);
    }

    function addhaul(){
        var t=$("#templete").html();
        l++;
        i++;
        t=t.replace(/{line}/g,l).replace(/{number}/g,i);
        $("#haul_div").append(t);
        bindListener();
        //给模版绑定事件
        $(".addhandle2:last").on("click",addhandle);
        
        $("[id^='h_linkman_img_']").off("click");
        $("[id^='h_linkman_img_']").on("click",man_click);

        $("[id^='h_linkman_tel_img_']").off("click");
        $("[id^='h_linkman_tel_img_']").on("click",tel_click);

        $("[id^='h_address_img_']").off("click");
        $("[id^='h_address_img_']").on("click",address_click);

        $("[id^='h_date_img_']").off("click");
        $("[id^='h_date_img_']").on("click",time_click);
    }
    function bindListener(){
        $(".rmlink").unbind().click(function(){
            var v=$(this).attr("del_haul");
            var t=$(this);
            if(confirm("是否要删除此行?")){
                if(v>0){
                    $.ajax({
                        type: "post",
                        url: "index.php?app=haul_define_main&act=drophaul",
                        data: {id:v},
                        dataType: "json",
                        success: function(data){
                            if(data.done){
                                t.parent().remove();
                                if($("#haul_div").find("div.haul_child_div").length==0){
                                    addhaul();
                                }
                            }else{
                                alert(data.msg);
                            }
                        }
                    });
                }else{
                    t.parent().remove();
                    if($("#haul_div").find("div.haul_child_div").length==0){
                        addhaul();
                    }
                }
            }
        })
    }
    function addhandle(){
        var th=$("#templete_handle").html();
        i++;
        var haul_num = $(this).attr('var');
        th=th.replace(/{line}/g,haul_num).replace(/{number}/g,i);
        $(this).parents(".itemdiv").append(th);
        bindListener2();
    }
    function bindListener2(){
        $(".rmhandle").unbind().click(function(){
            var i=$(this).attr("del_haul_collect");
            var t=$(this);
            if(confirm("是否要删除此行?")){
                if(i>0){
                    $.ajax({
                        type: "post",
                        url: "index.php?app=haul_define_main&act=drop_haul_define_collect",
                        data: {id:i},
                        dataType: "json",
                        success: function(data){
                            if(data.done){
                                t.parent().remove();
                                if($(".itemdiv").find("div.handle_sub").length==0){
                                    addhandle();
                                }
                            }else{
                                alert(data.msg);
                            }
                        }
                    });
                }else{
                    t.parent().remove();
                    if($(".itemdiv").find("div.handle_sub").length==0){
                        addhandle();
                    }
                }
            }

        })
    }
</script>
<style>
    .haul_child_div{
        border-left: 4px solid #76b5ea;
        border-top: 1px solid #d3dae0;
        border-bottom: 1px solid #d3dae0;
        margin: 10px 0 0 20px
    }
    .clear{
        clear: both;
    }
</style>
<style>
.infoTable{
margin: 0 0 0 0;
}
.info th {
    text-align: right;
    
}
#form11 th,#form1 th{
text-align: right;
    padding-right: 15px;
}
.infoTableInput,.infoTable select{
	width: 100%;
}
.grayb{background: #eee;}
.info td a{color: #1874CD}
.itemdiv .querySelect{height: 23px;
   width:200px;
    border: 1px solid #ccc;
    outline: 0;
    font-size: 14px;
    line-height: 19px;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;}
    .itemdiv .infoTableInput{height: 23px;
   width:300px;
    padding: 0 5px;
    border: 1px solid #ccc;
    outline: 0;
    font-size: 14px;
    line-height: 19px;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;}
    .itemdiv a,.rmlink{
        display: inline-block !important;
    height: 23px;
    margin: 5px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: 0;
    background-image: none;
    background-color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 23px;
    color: #1a1a1a;
    text-align: center;
    vertical-align: top;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -o-box-sizing: border-box;
    background-color: #0ae;
    border-color: #0ae;
    color: #fff;
    text-shadow: none;
    }
</style>
<div id="rightTop">
	<p>运程方案</p>
	<ul class="subnav">
		<li><a class="btn1" href="index.php?app=haul_define_main">{$lang.manage}</a>
		</li>
		{if $haul_define_main.zhdm_tid}
		<li><span>{$lang.edit}</span></li>
		{else}
		<li><span>{$lang.add}</span></li>
		{/if}
	</ul>
</div>
<!--js添加模版-->
<div id="templete" style="display: none;">
	<div  class = 'haul_child_div'>
        <a  href="javascript:;" style="float: right;margin-right: 20px" class="rmlink" del_haul="">删除</a>
        <table class="infoTable">
            <tr>
                <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>运程简称:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput" type="text" placeholder="运程简称必填" name="haul[{line}][h_short_name]" item="{line}" id="h_short_name_{line}" value="" />
                    <input type="hidden" name="haul[{line}][h_tid]" class='h_tid' value="" />
                </td>
                <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>运程名称:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput" type="text" placeholder="运程名称必填" name="haul[{line}][h_name]" item="{line}" id="h_name_{line}" value=""  />
                </td>
                <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>确认类型: </th>
                <td class="paddingT15 wordSpacing5">
                    <select class="querySelect" id="h_type_{line}" name="haul[{line}][h_type]" >{html_options options=$haultype selected=$h.h_type}</select>
                </td>
            </tr>
            <tr>
                <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>联系人:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput" type="text" placeholder="联系人必填" name="haul[{line}][h_linkman]" item="{line}" value="" id="h_linkman_{line}" />
                    <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="{line}" id="h_linkman_img_{line}"></a>
                </td>
                <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>联系电话:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput" type="text" placeholder="联系电话必填" name="haul[{line}][h_linkman_tel]" item="{line}" value="" id="h_linkman_tel_{line}" />
                    <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="{line}" id="h_linkman_tel_img_{line}"></a>
                </td>
                <th class="paddingT15 range">运程范围:</th>
                <td class="paddingT15 wordSpacing5 range" >
                    <input class="infoTableInput" placeholder="请填写数字" type="text" name="haul[{line}][h_range]" item="{line}" value="" id="h_range_{line}"/>
                </td>
            </tr>
            <tr>
                <th class="paddingT15">地址:</th>
                <td class="paddingT15 wordSpacing5" >
                    <input class="infoTableInput" type="text" name="haul[{line}][h_address]" value="" id="h_address_{line}"/>
                    <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="{line}" id="h_address_img_{line}"></a>
                </td>
                <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>运程顺序:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput" placeholder="请填写数字,数字越小,越靠前" type="text" name="haul[{line}][h_order]" item="{line}" value="" id="h_order_{line}"/>
                </td>
                <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>是否必须:</th>
                <td class="paddingT15 wordSpacing5">
                    <label>
                        <input name="haul[{line}][h_required]" type="radio" value="1" checked="checked"/>
                        是
                    </label>
                    <label>
                        <input type="radio" name="haul[{line}][h_required]" value="0" />
                        否
                    </label>
                </td>
            </tr>
            <tr>
                <th class="paddingT15">时间:</th>
                <td class="paddingT15 wordSpacing5" >
                    <input class="infoTableInput" type="text" name="haul[{line}][h_date]" value="-" id="h_date_{line}" />
                    <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="{line}" id="h_date_img_{line}"></a>
                    <script>
                        $('#h_date_{line}').datetimepicker({changeMonth: true,changeYear: true});
                    </script>
                </td>
            </tr>
        </table>
        <div style="background: #f3f7fa;" class="itemdiv">
           <a class="addhandle addhandle2" var="{line}">采集信息</a>
            <div>
                <input type="hidden" name="haul[{line}][item][{number}][hc_tid]" value="" />
                <p style="float: left;margin: 0 40px"><b style="color: #ff0000">*&nbsp;</b>操作：
                    <select class="querySelect" name="haul[{line}][item][{number}][h_collect_type]" >{html_options options=$ctype selected=$i.h_collect_type}</select>
                </p>
                <p style="float: left;margin: 0 40px">描述：
                    <input class="infoTableInput" type="text"  name="haul[{line}][item][{number}][h_collect_des]" value="" style="float: none"/>
                </p>
                <p style="float: left;margin: 0 40px">说明：
                    <input class="infoTableInput" type="text"  name="haul[{line}][item][{number}][h_collect_val]" value="" style="float: none"/>
                </p>
                <a  href="javascript:;" class="rmhandle" del_haul_collect="">删除</a>
                <div style="clear: both"></div>
            </div>
            <div style="clear: both"></div>
        </div>
	</div>
</div>
<div id="templete_handle" style="display: none;">
    <div>
        <input type="hidden" name="haul[{line}][item][{number}][hc_tid]" value="" />
        <p style="float: left;margin: 0 40px"><b style="color: #ff0000">*&nbsp;</b>操作：
            <select class="querySelect" name="haul[{line}][item][{number}][h_collect_type]" >{html_options options=$ctype selected=$i.h_collect_type}</select>
        </p>
        <p style="float: left;margin: 0 40px">描述：
            <input class="infoTableInput" type="text"  name="haul[{line}][item][{number}][h_collect_des]" value="" style="float: none"/>
        </p>
        <p style="float: left;margin: 0 40px">说明：
            <input class="infoTableInput" type="text"  name="haul[{line}][item][{number}][h_collect_val]" value="" style="float: none"/>
        </p>
        <a  href="javascript:;" class="rmhandle" del_haul_collect="">删除</a>
        <div style="clear: both"></div>
    </div>
</div>
<div class="info">
    <div class="jui-cut-label fn-mt25">
	        <div class="jui-message-bar">方案信息</div>
	</div>
	<form method="post" enctype="multipart/form-data" id="main_form">
		<table class="infoTable">
		    <tr>
                 <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>业务类型:</th>
                 <td class="paddingT15 wordSpacing5">
                      <select   class="infoTableInput" placeholder="业务类型必填" name="zhdm_type" id="zhdm_type"  {if $haul_define_main.zhdm_tid>0}disabled{/if}>
                          {html_options options=$types selected=$haul_define_main.zhdm_type}
                      </select>
                 </td>
                 <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>运程定义:</th>
                 <td class="paddingT15 wordSpacing5" style="text-align: left;">
                    <input class="infoTableInput2" placeholder="运程定义必填" id="zhdm_name" type="text" name="zhdm_name" value="{$haul_define_main.zhdm_name}" />
                 </td>
                 <th class="paddingT15">
                    货主:</th>
                 <td class="paddingT15 wordSpacing5">
                    <input type="hidden" value="{$haul_define_main.zhdm_consignor}" name="zhdm_consignor" id="zhdm_consignor">
                    <input type="text"  value="{$haul_define_main.zhdm_consignor_name}" item="{$haul_define_main.zhdm_consignor}" name="zhdm_consignor_name" id="zhdm_consignor_name" class="infoTableInput">
                    <a href="javascript:void(0);" class="right_a" id="zhdm_consignor_img"><img src="templates/images/newadmin/serch.png" alt=""></a>
                 </td>
            </tr>
			<tr>
				<th class="paddingT15"><b style="color: #ff0000">&nbsp;</b>备注:</th>
				<td class="paddingT15 wordSpacing5" style="text-align: left;"><textarea
					 id="zhdm_note" name="zhdm_note" style="width: 300px;height: 100px;">{$haul_define_main.zhdm_note}</textarea> </td>
			</tr>
		</table>
        <div class="jui-cut-label fn-mt25">
            <div class="jui-message-bar">运程定义<a style="float: right;margin-right: 20px" onclick="addhaul();">添加运程定义</a></div>
        </div>
            <div id="haul_div">
            {if $haul_define_main.haul}
                {foreach from=$haul_define_main.haul item=h}
                <div  class= 'haul_child_div '>
                    <a  href="javascript:;"  style="float: right;margin-right: 20px" class="rmlink" del_haul="{$h.h_tid}">删除</a>
                    <table class="infoTable">
                        <tr>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>运程简称:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text" placeholder="运程简称必填" name="haul[{$h.h_tid}][h_short_name]" item="{$h.h_tid}" id="h_short_name_{$h.h_tid}" value="{$h.h_short_name}" />
                                <input type="hidden" name="haul[{$h.h_tid}][h_tid]" value="{$h.h_tid}" />
                            </td>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>运程名称:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text" placeholder="运程名称必填" name="haul[{$h.h_tid}][h_name]" value="{$h.h_name}" item="{$h.h_tid}" id="h_name_{$h.h_tid}"/>
                            </td>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>确认类型: </th>
                            <td class="paddingT15 wordSpacing5">
                                <select class="querySelect" id="h_type_{$h.h_tid}" name="haul[{$h.h_tid}][h_type]" >{html_options options=$haultype selected=$h.h_type}</select>
                            </td>
                        </tr>
                        <tr>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>联系人:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text"  placeholder="联系人必填" name="haul[{$h.h_tid}][h_linkman]" value="{$h.h_linkman}" item="{$h.h_tid}" id="h_linkman_{$h.h_tid}" />
                                <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="{$h.h_tid}" id="h_linkman_img_{$h.h_tid}"></a>
                            </td>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>联系电话:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text" placeholder="联系电话必填" name="haul[{$h.h_tid}][h_linkman_tel]" value="{$h.h_linkman_tel}" item="{$h.h_tid}" id="h_linkman_tel_{$h.h_tid}" />
                                <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="{$h.h_tid}" id="h_linkman_tel_img_{$h.h_tid}"></a>
                            </td>

                            <th class="paddingT15 range" style="display:{if $h.h_type==1}none{/if}">运程范围:</th>
                            <td class="paddingT15 wordSpacing5 range" style="display:{if $h.h_type==1}none{/if}">
                                <input class="infoTableInput" placeholder="请填写数字" type="text" name="haul[{$h.h_tid}][h_range]" item="{$h.h_tid}" value="{$h.h_range}" id="h_range_{$h.h_tid}"/>
                            </td>

                        </tr>
                        <tr>
                            <th class="paddingT15">地址:</th>
                            <td class="paddingT15 wordSpacing5" >
                                <input class="infoTableInput" type="text" name="haul[{$h.h_tid}][h_address]" value="{$h.h_address}" id="h_address_{$h.h_tid}" />
                                <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="{$h.h_tid}" id="h_address_img_{$h.h_tid}"></a>
                            </td>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>运程顺序:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text" placeholder="请填写数字,数字越小,越靠前" name="haul[{$h.h_tid}][h_order]" value="{$h.h_order}" item="{$h.h_tid}" id="h_order_{$h.h_tid}" />
                            </td>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>是否必须:</th>
                            <td class="paddingT15 wordSpacing5">
                                <label>
                                    <input name="haul[{$h.h_tid}][h_required]" type="radio" value="1" {if $h.h_required eq 1}checked="checked"{/if} />
                                    是
                                </label>
                                <label>
                                    <input name="haul[{$h.h_tid}][h_required]" type="radio" value="0" {if $h.h_required eq 0}checked="checked"{/if} />
                                    否
                                </label>
                            </td>
                        </tr>
                        <tr>
                            <th class="paddingT15">时间:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text" name="haul[{$h.h_tid}][h_date]" value="{if $h.h_date>0}{$h.h_date|date:Y-m-d H:i}{else}{$h.h_date}{/if}" id="h_date_{$h.h_tid}" />
                                <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="{$h.h_tid}" id="h_date_img_{$h.h_tid}"></a>
                                <script>
                                    $('#h_date_{$h.h_tid}').datetimepicker({changeMonth: true,changeYear: true});
                                </script>
                            </td>
                        </tr>
                    </table>

                    <div style="background: #f3f7fa;" class="itemdiv">
                       <a class="addhandle" var="{$h.h_tid}">采集信息</a>
                        {if $h.hc_haul}
                            {foreach from=$h.hc_haul item=i}
                        <div>
                            <input type="hidden" name="haul[{$h.h_tid}][item][{$i.hc_tid}][hc_tid]" value="{$i.hc_tid}" />
                            <p style="float: left;margin: 0 40px"><b style="color: #ff0000">*&nbsp;</b>操作：
                                <select class="querySelect" name="haul[{$h.h_tid}][item][{$i.hc_tid}][h_collect_type]" >{html_options options=$ctype selected=$i.h_collect_type}</select>
                            </p>
                            <p style="float: left;margin: 0 40px">描述：
                                <input class="infoTableInput" type="text"  name="haul[{$h.h_tid}][item][{$i.hc_tid}][h_collect_des]" value="{$i.h_collect_des}" style="float: none"/>
                            </p>
                            <p style="float: left;margin: 0 40px">说明：
                                <input class="infoTableInput" type="text"  name="haul[{$h.h_tid}][item][{$i.hc_tid}][h_collect_val]" value="{$i.h_collect_val}" style="float: none"/>
                            </p>
                            <a  href="javascript:;" class="rmhandle" del_haul_collect="{$i.hc_tid}">删除</a>
                            <div style="clear: both"></div>
                        </div>
                        {/foreach}
                        {else}
                        <div>
                            <input type="hidden" name="haul[{$h.h_tid}][item][0][hc_tid]" value="0" />
                            <p style="float: left;margin: 0 40px"><b style="color: #ff0000">*&nbsp;</b>操作：
                                <select class="querySelect" name="haul[{$h.h_tid}][item][0][h_collect_type]" >{html_options options=$ctype selected=$i.h_collect_type}</select>
                            </p>
                            <p style="float: left;margin: 0 40px">描述：
                                <input class="infoTableInput" type="text"  name="haul[{$h.h_tid}][item][0][h_collect_des]" value="" style="float: none"/>
                            </p>
                            <p style="float: left;margin: 0 40px">说明：
                                <input class="infoTableInput" type="text"  name="haul[{$h.h_tid}][item][0][h_collect_val]" value="" style="float: none"/>
                            </p>
                            <a  href="javascript:;" class="rmhandle" del_haul_collect="0">删除</a>
                            <div style="clear: both"></div>
                        </div>
                        {/if}
                        <div style="clear: both"></div>
                    </div>
                </div>
                {/foreach}
                {else}
                <div  class= 'haul_child_div '>
                    <a  href="javascript:;"  style="float: right;margin-right: 20px" class="rmlink" del_haul="0">删除</a>
                    <table class="infoTable">
                        <tr>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>运程简称:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text" name="haul[0][h_short_name]" placeholder="运程简称必填" id="h_short_name_0" item="0" value="{$h.h_short_name}" />
                                <input type="hidden" name="haul[0][h_tid]" value="0" />
                            </td>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>运程名称:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text" placeholder="运程名称必填" name="haul[0][h_name]" value="{$h.h_name}"  item="0" id="h_name_0"/>
                            </td>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>确认类型: </th>
                            <td class="paddingT15 wordSpacing5">
                                <select class="querySelect" id="h_type_0" name="haul[0][h_type]" >{html_options options=$haultype selected=$h.h_type}</select>
                            </td>
                        </tr>
                        <tr>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>联系人:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text" placeholder="联系人必填" name="haul[0][h_linkman]" value="{$h.h_linkman}" item="0" id="h_linkman_0"/>
                                <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="0" id="h_linkman_img_0"></a>
                            </td>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>联系电话:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text"  placeholder="联系电话必填" name="haul[0][h_linkman_tel]" value="{$h.h_linkman_tel}" item="0" id="h_linkman_tel_0" />
                                <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="0" id="h_linkman_tel_img_0"></a>
                            </td>
                            <th class="paddingT15 range">运程范围:</th>
                            <td class="paddingT15 wordSpacing5 range">
                                <input class="infoTableInput" type="text" placeholder="请填写数字" name="haul[0][h_range]" value="{$h.h_range}" item="0" id="h_range_0"/>
                            </td>
                        </tr>
                        <tr>
                            <th class="paddingT15">地址:</th>
                            <td class="paddingT15 wordSpacing5" >
                                <input class="infoTableInput" type="text" name="haul[0][h_address]" value="{$h.h_address}" id="h_address_0"/>
                                <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="0" id="h_address_img_0"></a>
                            </td>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>运程顺序:</th>
                            <td class="paddingT15 wordSpacing5">
                                <input class="infoTableInput" type="text" placeholder="请填写数字,数字越小,越靠前" name="haul[0][h_order]" value="{$h.h_order}" item="0" id="h_order_0"/>
                            </td>
                            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>是否必须:</th>
                            <td class="paddingT15 wordSpacing5">
                                <label>
                                    <input name="haul[0][h_required]" type="radio" value="1" checked="checked"/>
                                    是
                                </label>
                                <label>
                                    <input type="radio" name="haul[0][h_required]" value="0" />
                                    否
                                </label>
                            </td>
                        </tr>
                        <tr>
                            <th class="paddingT15">时间:</th>
                            <td class="paddingT15 wordSpacing5" >
                                <input class="infoTableInput" type="text" name="haul[0][h_date]" value="-" id="h_date_0" />
                                <script>
                                    $('#h_date_0').datetimepicker({changeMonth: true,changeYear: true});
                                </script>
                                <a href="javascript:void(0);" class="right_a"><img src="templates/images/newadmin/serch.png" alt=""  item="0" id="h_date_img_0"></a>
                            </td>
                        </tr>
                    </table>

                    <div style="background: #f3f7fa;" class="itemdiv">
                        <a class="addhandle"  var="0">采集信息</a>
                        <div>
                            <input type="hidden" name="haul[0][item][0][hc_tid]" value="{$i.hc_tid}" />
                            <p style="float: left;margin: 0 40px"><b style="color: #ff0000">*&nbsp;</b>操作：
                                <select class="querySelect" name="haul[0][item][0][h_collect_type]" >{html_options options=$ctype selected=$i.h_collect_type}</select>
                            </p>
                            <p style="float: left;margin: 0 40px">描述：
                                <input class="infoTableInput" type="text"  name="haul[0][item][0][h_collect_des]" value="" style="float: none"/>
                            </p>
                            <p style="float: left;margin: 0 40px">说明：
                                <input class="infoTableInput" type="text"  name="haul[0][item][0][h_collect_val]" value="" style="float: none"/>
                            </p>
                            <a  href="javascript:;" class="rmhandle" del_haul_collect="0">删除</a>
                            <div style="clear: both"></div>
                        </div>
                        <div style="clear: both"></div>
                    </div>
                </div>
                {/if}
            </div>
           <table class="infoTable">
                        <tr>
                            <th class="paddingT15"></th>
                            <td class="paddingT15 wordSpacing5">
                    <input class="formbtn" type="button" name="Submit" value="{$lang.submit}" />
            </td></tr></table>
        </form>

</div>
<div style="display: none"  >
    <div id="hzlist">
        <iframe id="hzframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
    </div>
</div>
<div style="display: none"  >
    <div id="manlist">
        <iframe id="manframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
    </div>
</div>
<div style="display: none"  >
    <div id="tellist">
        <iframe id="telframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
    </div>
</div>
<div style="display: none"  >
    <div id="addresslist">
        <iframe id="addressframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
    </div>
</div>
<div style="display: none"  >
    <div id="timelist">
        <iframe id="timeframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
    </div>
</div>
{include file="footer.html"}
